<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta  charset="utf-8">
<meta  name="viewport"  content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>兑换 - {php echo $this->module['config']['sname']}</title>
{php echo register_jssdk();}
<link  rel="stylesheet"  href="../addons/weliam_indiana/static/css/css.css">
<link href="http://mimg.127.net/p/yymobile/1505131503/css/common.css" rel="stylesheet">
<script   src="../addons/weliam_indiana/template/js/jquery.js" type="text/javascript"></script>
<script  src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js" type="text/javascript"></script>
</head>
<body  style="background:#f6f6f8;">
<style>
#moreBtn{position: fixed; top: 0; right: 5px; z-index: 2; padding: 0 10px; line-height: 36px;}
</style>
<div class="m-simpleHeader" id="dvHeader">
	<a href="javascript:history.back(-1);" data-pro="back" data-back="true" class="m-simpleHeader-back"><i class="ico ico-back"></i></a>
	<h1>兑换幸运码</h1>
	<a id="moreBtn" href="{php echo $this->createMobileUrl('index')}"><i class="ico ico-home"></i></a>
</div>
<section  class="wrap">
	<form id="form1" action="javascript:;" method="post">
	<section  class="white_box">
		<dl  class="order">
			<dt  class="pri_img1"> 
				<a  id="oneGiftLink"  title="(第{$goods['periods']}期){$goods['title']}"><img  id="oneGiftImg"  src="{$_W['attachurl']}{$goods['picarr']}"  alt="(第{$goods['periods']}期){$goods['title']}"></a>
			</dt>
			<dd  class="pri_info1">
				<h3  class="pri_tit"> 
					<a  id="oneGiftName"  title="(第{$goods['periods']}期){$goods['title']}">(第{$goods['periods']}期){$goods['title']}</a>
				</h3>
				<p>总需：<span  id="oneGiftNeed">{$goods['zongrenshu']}</span>份，剩余：<span  id="oneGiftLeft"  class="fc" value="{$goods['shengyurenshu']}">{$goods['shengyurenshu']}</span>份</p>
				<div  id="oneChangeOpt"  class="rec_box"  style=""> 兑换
					<div  class="item_amount ">
						<input  id="oneChangeNum"  type="text"  class="ip_num"  value="1">
						<textarea id="experience" name="experience" style="display: none;">{$goods['shengyurenshu']}</textarea>
					</div> 
					<span  class="rec_txt">个幸运码</span>
				</div>
			</dd>
		</dl>
	</section>
	</form>
	<section  id="oneDoWrap"  class="abs_bottom"  style="">
		<div  class="submit">
			<p>每个幸运码需<span  id="oneDoChangeNum"  class="fc">1</span>元</p>
			<a  id="oneDoChange"  href="javascript:submit();"  title="提交"  class="smt_btn">提交订单</a>
		</div>
	</section>
</section>
<script type="text/javascript">
	function submit(){	    
    	var form_input = document.getElementById("form1");
    	var shengyurenshu=form_input['experience'].value;
    	var ip_num=form_input['oneChangeNum'].value;

		if (ip_num>Number(shengyurenshu)) {
			alert('兑换数量超过剩余数量！');
			return false;
		}

		if (ip_num<1) {
			alert('请输入不小于1的整数！');
			return false;
		}
		var url="./index.php?i="+{php echo $uniacid}+"&c=entry&periods="+{php echo $goods['periods']}+"&id="+{php echo $goods['id']}+"&count="+ip_num+"&do=postorder&m=weliam_indiana&wxref=mp.weixin.qq.com#wechat_redirect";
		window.location.href=url;
	}
</script>
</body>
<script>
	wx.ready(function (){
	var shareData = {
		title: "{$share_data['share_title']}",
		desc: "{$share_data['share_desc']}",
		link: "{$_W['siteroot']}app/{php echo str_replace('./','',$this->createMobileUrl('mshare', array('op'=>'invite', 'sopenid'=>$_W['openid'])))}",
		imgUrl: "{$_W['attachurl']}{$share_data['share_image']}",
	};
//分享朋友
	wx.onMenuShareAppMessage({
	    title: shareData.title,
	  	desc: shareData.desc,
	  	link: shareData.link,
	  	imgUrl:shareData.imgUrl,
	  	trigger: function (res) {
	  	},
	  	success: function (res) {
	    	window.location.href =adurl;
	  	},
	  	cancel: function (res) {
	  	},
	  	fail: function (res) {
	    	alert(JSON.stringify(res));
	  	}
	});
//朋友圈
	wx.onMenuShareTimeline({
	  	title: shareData.title,
	  	link: shareData.link,
	  	imgUrl:shareData.imgUrl,
	  	trigger: function (res) {
	  	},
	  	success: function (res) {
	    	window.location.href =adurl;
	  	},
	  	cancel: function (res) {
	  	},
	  	fail: function (res) {
	    	alert(JSON.stringify(res));
	  	}
	});
});
</script>
</html>